package com.qdlc.p2p.dal.model;

import org.springframework.beans.BeanUtils;

import com.qdlc.p2p.dal.dto.ReceivingInfo;

/**
 * 收货地址信息model
 * @author xxx
 * @version 2.0
 * @date 2015年6月23日 上午11:00:16
 */
public class ReceivingInfoModel extends ReceivingInfo {

	//搜索框输入字符串
	private String searchName;
	//用户名
	private String userName;
	//当前页
	private int page;
	//每页记录数
	private int rows;

	/** 禁用/删除 */
	public static final int RECEIVINGINFO_STATUS_DISABLE = -1;
	/** 启用 */
	public static final int RECEIVINGINFO_STATUS_ENABLE = 1;
	
	public static ReceivingInfoModel instance(ReceivingInfo receivingInfo) {
		ReceivingInfoModel receivingInfoModel = new ReceivingInfoModel();
		BeanUtils.copyProperties(receivingInfo, receivingInfoModel);
		return receivingInfoModel;
	}
	
	public ReceivingInfo prototype() {
		ReceivingInfo receivingInfo = new ReceivingInfo();
		BeanUtils.copyProperties(this, receivingInfo);
		return receivingInfo;
	}
	
	public ReceivingInfo prototypeForAppend() {
		ReceivingInfo receivingInfo = new ReceivingInfo();
		BeanUtils.copyProperties(this, receivingInfo);
		receivingInfo.setUserId(getUserId());
		receivingInfo.setStatus(RECEIVINGINFO_STATUS_ENABLE);
		return receivingInfo;
	}

	public String getSearchName() {
		return searchName;
	}

	public void setSearchName(String searchName) {
		this.searchName = searchName;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getRows() {
		return rows;
	}

	public void setRows(int rows) {
		this.rows = rows;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
}
